<template>
  <div class="report-container">
    <iframe 
      :src="url" 
  
     class="iframe-container"

    ></iframe>
  </div>
</template>

<script>
import { getToken } from '@/utils/auth'
import { getReportViewUrl } from '@/api/tool/jimu'

export default {
  name: 'ReportView',
  data() {
    return {
      url: ''
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      getReportViewUrl().then(res => {
        const reportId = this.$route.path.substring(this.$route.path.lastIndexOf("/") + 1)
        this.url = `${res}/${reportId}?token=Bearer ${getToken()}`
      }).catch(error => {
        console.error('获取报表URL失败:', error)
        this.$message.error('报表加载失败，请稍后重试')
      })
    },
   
  }
}
</script>
<style>
.iframe-container {
  width: 100%;
  height: calc(100vh - 84px);
  border: 0;
  overflow: hidden;
}</style>